// **********************************************************************
//
// Copyright (c) 2003-2009 ZeroC, Inc. All rights reserved.
//
// This copy of Ice is licensed to you under the terms described in the
// ICE_LICENSE file included in this distribution.
//
// **********************************************************************

// Ice version 3.3.1
// Generated from file `CommonHead.ice'

#include <CommonHead.h>
#include <Ice/LocalException.h>
#include <Ice/ObjectFactory.h>
#include <Ice/BasicStream.h>
#include <IceUtil/Iterator.h>
#include <IceUtil/ScopedArray.h>

#ifndef ICE_IGNORE_VERSION
#   if ICE_INT_VERSION / 100 != 303
#       error Ice version mismatch!
#   endif
#   if ICE_INT_VERSION % 100 > 50
#       error Beta header file detected
#   endif
#   if ICE_INT_VERSION % 100 < 1
#       error Ice patch level mismatch!
#   endif
#endif

static const ::std::string __RoboCompCommonHead__CommonHead__resetHead_name = "resetHead";

static const ::std::string __RoboCompCommonHead__CommonHead__stopHead_name = "stopHead";

static const ::std::string __RoboCompCommonHead__CommonHead__setPanLeft_name = "setPanLeft";

static const ::std::string __RoboCompCommonHead__CommonHead__setPanRight_name = "setPanRight";

static const ::std::string __RoboCompCommonHead__CommonHead__setTilt_name = "setTilt";

static const ::std::string __RoboCompCommonHead__CommonHead__setNeck_name = "setNeck";

static const ::std::string __RoboCompCommonHead__CommonHead__saccadic2DLeft_name = "saccadic2DLeft";

static const ::std::string __RoboCompCommonHead__CommonHead__saccadic2DRight_name = "saccadic2DRight";

static const ::std::string __RoboCompCommonHead__CommonHead__saccadic3D_name = "saccadic3D";

static const ::std::string __RoboCompCommonHead__CommonHead__saccadic4D_name = "saccadic4D";

static const ::std::string __RoboCompCommonHead__CommonHead__setNMotorsPosition_name = "setNMotorsPosition";

static const ::std::string __RoboCompCommonHead__CommonHead__getHeadParams_name = "getHeadParams";

static const ::std::string __RoboCompCommonHead__CommonHead__getHeadState_name = "getHeadState";

static const ::std::string __RoboCompCommonHead__CommonHead__isMovingHead_name = "isMovingHead";

::Ice::Object* IceInternal::upCast(::RoboCompCommonHead::CommonHead* p) { return p; }
::IceProxy::Ice::Object* IceInternal::upCast(::IceProxy::RoboCompCommonHead::CommonHead* p) { return p; }

void
RoboCompCommonHead::__read(::IceInternal::BasicStream* __is, ::RoboCompCommonHead::CommonHeadPrx& v)
{
    ::Ice::ObjectPrx proxy;
    __is->read(proxy);
    if(!proxy)
    {
        v = 0;
    }
    else
    {
        v = new ::IceProxy::RoboCompCommonHead::CommonHead;
        v->__copyFrom(proxy);
    }
}

void
RoboCompCommonHead::__writedmotorParams(::IceInternal::BasicStream* __os, const ::RoboCompCommonHead::dmotorParams& v)
{
    __os->writeSize(::Ice::Int(v.size()));
    ::RoboCompCommonHead::dmotorParams::const_iterator p;
    for(p = v.begin(); p != v.end(); ++p)
    {
        __os->write(p->first);
        p->second.__write(__os);
    }
}

void
RoboCompCommonHead::__readdmotorParams(::IceInternal::BasicStream* __is, ::RoboCompCommonHead::dmotorParams& v)
{
    ::Ice::Int sz;
    __is->readSize(sz);
    while(sz--)
    {
        ::std::pair<const  ::std::string, ::RoboCompJointMotor::MotorParams> pair;
        __is->read(const_cast< ::std::string&>(pair.first));
        ::RoboCompCommonHead::dmotorParams::iterator __i = v.insert(v.end(), pair);
        __i->second.__read(__is);
    }
}

bool
RoboCompCommonHead::THeadParams::operator==(const THeadParams& __rhs) const
{
    if(this == &__rhs)
    {
        return true;
    }
    if(motorsParams != __rhs.motorsParams)
    {
        return false;
    }
    if(model != __rhs.model)
    {
        return false;
    }
    return true;
}

bool
RoboCompCommonHead::THeadParams::operator<(const THeadParams& __rhs) const
{
    if(this == &__rhs)
    {
        return false;
    }
    if(motorsParams < __rhs.motorsParams)
    {
        return true;
    }
    else if(__rhs.motorsParams < motorsParams)
    {
        return false;
    }
    if(model < __rhs.model)
    {
        return true;
    }
    else if(__rhs.model < model)
    {
        return false;
    }
    return false;
}

void
RoboCompCommonHead::THeadParams::__write(::IceInternal::BasicStream* __os) const
{
    ::RoboCompCommonHead::__writedmotorParams(__os, motorsParams);
    __os->write(model);
}

void
RoboCompCommonHead::THeadParams::__read(::IceInternal::BasicStream* __is)
{
    ::RoboCompCommonHead::__readdmotorParams(__is, motorsParams);
    __is->read(model);
}

void
RoboCompCommonHead::__writedmotorsState(::IceInternal::BasicStream* __os, const ::RoboCompCommonHead::dmotorsState& v)
{
    __os->writeSize(::Ice::Int(v.size()));
    ::RoboCompCommonHead::dmotorsState::const_iterator p;
    for(p = v.begin(); p != v.end(); ++p)
    {
        __os->write(p->first);
        p->second.__write(__os);
    }
}

void
RoboCompCommonHead::__readdmotorsState(::IceInternal::BasicStream* __is, ::RoboCompCommonHead::dmotorsState& v)
{
    ::Ice::Int sz;
    __is->readSize(sz);
    while(sz--)
    {
        ::std::pair<const  ::std::string, ::RoboCompJointMotor::MotorState> pair;
        __is->read(const_cast< ::std::string&>(pair.first));
        ::RoboCompCommonHead::dmotorsState::iterator __i = v.insert(v.end(), pair);
        __i->second.__read(__is);
    }
}

bool
RoboCompCommonHead::THeadState::operator==(const THeadState& __rhs) const
{
    if(this == &__rhs)
    {
        return true;
    }
    if(motorsState != __rhs.motorsState)
    {
        return false;
    }
    if(isMoving != __rhs.isMoving)
    {
        return false;
    }
    return true;
}

bool
RoboCompCommonHead::THeadState::operator<(const THeadState& __rhs) const
{
    if(this == &__rhs)
    {
        return false;
    }
    if(motorsState < __rhs.motorsState)
    {
        return true;
    }
    else if(__rhs.motorsState < motorsState)
    {
        return false;
    }
    if(isMoving < __rhs.isMoving)
    {
        return true;
    }
    else if(__rhs.isMoving < isMoving)
    {
        return false;
    }
    return false;
}

void
RoboCompCommonHead::THeadState::__write(::IceInternal::BasicStream* __os) const
{
    ::RoboCompCommonHead::__writedmotorsState(__os, motorsState);
    __os->write(isMoving);
}

void
RoboCompCommonHead::THeadState::__read(::IceInternal::BasicStream* __is)
{
    ::RoboCompCommonHead::__readdmotorsState(__is, motorsState);
    __is->read(isMoving);
}

void
IceProxy::RoboCompCommonHead::CommonHead::resetHead(const ::Ice::Context* __ctx)
{
    int __cnt = 0;
    while(true)
    {
        ::IceInternal::Handle< ::IceDelegate::Ice::Object> __delBase;
        try
        {
#if defined(__BCPLUSPLUS__) && (__BCPLUSPLUS__ >= 0x0600) // C++Builder 2009 compiler bug
            IceUtil::DummyBCC dummy;
#endif
            __delBase = __getDelegate(false);
            ::IceDelegate::RoboCompCommonHead::CommonHead* __del = dynamic_cast< ::IceDelegate::RoboCompCommonHead::CommonHead*>(__delBase.get());
            __del->resetHead(__ctx);
            return;
        }
        catch(const ::IceInternal::LocalExceptionWrapper& __ex)
        {
            __handleExceptionWrapper(__delBase, __ex, 0);
        }
        catch(const ::Ice::LocalException& __ex)
        {
            __handleException(__delBase, __ex, 0, __cnt);
        }
    }
}

void
IceProxy::RoboCompCommonHead::CommonHead::stopHead(const ::Ice::Context* __ctx)
{
    int __cnt = 0;
    while(true)
    {
        ::IceInternal::Handle< ::IceDelegate::Ice::Object> __delBase;
        try
        {
#if defined(__BCPLUSPLUS__) && (__BCPLUSPLUS__ >= 0x0600) // C++Builder 2009 compiler bug
            IceUtil::DummyBCC dummy;
#endif
            __delBase = __getDelegate(false);
            ::IceDelegate::RoboCompCommonHead::CommonHead* __del = dynamic_cast< ::IceDelegate::RoboCompCommonHead::CommonHead*>(__delBase.get());
            __del->stopHead(__ctx);
            return;
        }
        catch(const ::IceInternal::LocalExceptionWrapper& __ex)
        {
            __handleExceptionWrapper(__delBase, __ex, 0);
        }
        catch(const ::Ice::LocalException& __ex)
        {
            __handleException(__delBase, __ex, 0, __cnt);
        }
    }
}

void
IceProxy::RoboCompCommonHead::CommonHead::setPanLeft(::Ice::Float pan, const ::Ice::Context* __ctx)
{
    int __cnt = 0;
    while(true)
    {
        ::IceInternal::Handle< ::IceDelegate::Ice::Object> __delBase;
        try
        {
#if defined(__BCPLUSPLUS__) && (__BCPLUSPLUS__ >= 0x0600) // C++Builder 2009 compiler bug
            IceUtil::DummyBCC dummy;
#endif
            __checkTwowayOnly(__RoboCompCommonHead__CommonHead__setPanLeft_name);
            __delBase = __getDelegate(false);
            ::IceDelegate::RoboCompCommonHead::CommonHead* __del = dynamic_cast< ::IceDelegate::RoboCompCommonHead::CommonHead*>(__delBase.get());
            __del->setPanLeft(pan, __ctx);
            return;
        }
        catch(const ::IceInternal::LocalExceptionWrapper& __ex)
        {
            __handleExceptionWrapper(__delBase, __ex, 0);
        }
        catch(const ::Ice::LocalException& __ex)
        {
            __handleException(__delBase, __ex, 0, __cnt);
        }
    }
}

void
IceProxy::RoboCompCommonHead::CommonHead::setPanRight(::Ice::Float pan, const ::Ice::Context* __ctx)
{
    int __cnt = 0;
    while(true)
    {
        ::IceInternal::Handle< ::IceDelegate::Ice::Object> __delBase;
        try
        {
#if defined(__BCPLUSPLUS__) && (__BCPLUSPLUS__ >= 0x0600) // C++Builder 2009 compiler bug
            IceUtil::DummyBCC dummy;
#endif
            __checkTwowayOnly(__RoboCompCommonHead__CommonHead__setPanRight_name);
            __delBase = __getDelegate(false);
            ::IceDelegate::RoboCompCommonHead::CommonHead* __del = dynamic_cast< ::IceDelegate::RoboCompCommonHead::CommonHead*>(__delBase.get());
            __del->setPanRight(pan, __ctx);
            return;
        }
        catch(const ::IceInternal::LocalExceptionWrapper& __ex)
        {
            __handleExceptionWrapper(__delBase, __ex, 0);
        }
        catch(const ::Ice::LocalException& __ex)
        {
            __handleException(__delBase, __ex, 0, __cnt);
        }
    }
}

void
IceProxy::RoboCompCommonHead::CommonHead::setTilt(::Ice::Float tilt, const ::Ice::Context* __ctx)
{
    int __cnt = 0;
    while(true)
    {
        ::IceInternal::Handle< ::IceDelegate::Ice::Object> __delBase;
        try
        {
#if defined(__BCPLUSPLUS__) && (__BCPLUSPLUS__ >= 0x0600) // C++Builder 2009 compiler bug
            IceUtil::DummyBCC dummy;
#endif
            __checkTwowayOnly(__RoboCompCommonHead__CommonHead__setTilt_name);
            __delBase = __getDelegate(false);
            ::IceDelegate::RoboCompCommonHead::CommonHead* __del = dynamic_cast< ::IceDelegate::RoboCompCommonHead::CommonHead*>(__delBase.get());
            __del->setTilt(tilt, __ctx);
            return;
        }
        catch(const ::IceInternal::LocalExceptionWrapper& __ex)
        {
            __handleExceptionWrapper(__delBase, __ex, 0);
        }
        catch(const ::Ice::LocalException& __ex)
        {
            __handleException(__delBase, __ex, 0, __cnt);
        }
    }
}

void
IceProxy::RoboCompCommonHead::CommonHead::setNeck(::Ice::Float neck, const ::Ice::Context* __ctx)
{
    int __cnt = 0;
    while(true)
    {
        ::IceInternal::Handle< ::IceDelegate::Ice::Object> __delBase;
        try
        {
#if defined(__BCPLUSPLUS__) && (__BCPLUSPLUS__ >= 0x0600) // C++Builder 2009 compiler bug
            IceUtil::DummyBCC dummy;
#endif
            __checkTwowayOnly(__RoboCompCommonHead__CommonHead__setNeck_name);
            __delBase = __getDelegate(false);
            ::IceDelegate::RoboCompCommonHead::CommonHead* __del = dynamic_cast< ::IceDelegate::RoboCompCommonHead::CommonHead*>(__delBase.get());
            __del->setNeck(neck, __ctx);
            return;
        }
        catch(const ::IceInternal::LocalExceptionWrapper& __ex)
        {
            __handleExceptionWrapper(__delBase, __ex, 0);
        }
        catch(const ::Ice::LocalException& __ex)
        {
            __handleException(__delBase, __ex, 0, __cnt);
        }
    }
}

void
IceProxy::RoboCompCommonHead::CommonHead::saccadic2DLeft(::Ice::Float leftPan, ::Ice::Float tilt, const ::Ice::Context* __ctx)
{
    int __cnt = 0;
    while(true)
    {
        ::IceInternal::Handle< ::IceDelegate::Ice::Object> __delBase;
        try
        {
#if defined(__BCPLUSPLUS__) && (__BCPLUSPLUS__ >= 0x0600) // C++Builder 2009 compiler bug
            IceUtil::DummyBCC dummy;
#endif
            __checkTwowayOnly(__RoboCompCommonHead__CommonHead__saccadic2DLeft_name);
            __delBase = __getDelegate(false);
            ::IceDelegate::RoboCompCommonHead::CommonHead* __del = dynamic_cast< ::IceDelegate::RoboCompCommonHead::CommonHead*>(__delBase.get());
            __del->saccadic2DLeft(leftPan, tilt, __ctx);
            return;
        }
        catch(const ::IceInternal::LocalExceptionWrapper& __ex)
        {
            __handleExceptionWrapper(__delBase, __ex, 0);
        }
        catch(const ::Ice::LocalException& __ex)
        {
            __handleException(__delBase, __ex, 0, __cnt);
        }
    }
}

void
IceProxy::RoboCompCommonHead::CommonHead::saccadic2DRight(::Ice::Float rightPan, ::Ice::Float tilt, const ::Ice::Context* __ctx)
{
    int __cnt = 0;
    while(true)
    {
        ::IceInternal::Handle< ::IceDelegate::Ice::Object> __delBase;
        try
        {
#if defined(__BCPLUSPLUS__) && (__BCPLUSPLUS__ >= 0x0600) // C++Builder 2009 compiler bug
            IceUtil::DummyBCC dummy;
#endif
            __checkTwowayOnly(__RoboCompCommonHead__CommonHead__saccadic2DRight_name);
            __delBase = __getDelegate(false);
            ::IceDelegate::RoboCompCommonHead::CommonHead* __del = dynamic_cast< ::IceDelegate::RoboCompCommonHead::CommonHead*>(__delBase.get());
            __del->saccadic2DRight(rightPan, tilt, __ctx);
            return;
        }
        catch(const ::IceInternal::LocalExceptionWrapper& __ex)
        {
            __handleExceptionWrapper(__delBase, __ex, 0);
        }
        catch(const ::Ice::LocalException& __ex)
        {
            __handleException(__delBase, __ex, 0, __cnt);
        }
    }
}

void
IceProxy::RoboCompCommonHead::CommonHead::saccadic3D(::Ice::Float leftPan, ::Ice::Float rightPan, ::Ice::Float tilt, const ::Ice::Context* __ctx)
{
    int __cnt = 0;
    while(true)
    {
        ::IceInternal::Handle< ::IceDelegate::Ice::Object> __delBase;
        try
        {
#if defined(__BCPLUSPLUS__) && (__BCPLUSPLUS__ >= 0x0600) // C++Builder 2009 compiler bug
            IceUtil::DummyBCC dummy;
#endif
            __checkTwowayOnly(__RoboCompCommonHead__CommonHead__saccadic3D_name);
            __delBase = __getDelegate(false);
            ::IceDelegate::RoboCompCommonHead::CommonHead* __del = dynamic_cast< ::IceDelegate::RoboCompCommonHead::CommonHead*>(__delBase.get());
            __del->saccadic3D(leftPan, rightPan, tilt, __ctx);
            return;
        }
        catch(const ::IceInternal::LocalExceptionWrapper& __ex)
        {
            __handleExceptionWrapper(__delBase, __ex, 0);
        }
        catch(const ::Ice::LocalException& __ex)
        {
            __handleException(__delBase, __ex, 0, __cnt);
        }
    }
}

void
IceProxy::RoboCompCommonHead::CommonHead::saccadic4D(::Ice::Float leftPan, ::Ice::Float rightPan, ::Ice::Float tilt, ::Ice::Float neck, const ::Ice::Context* __ctx)
{
    int __cnt = 0;
    while(true)
    {
        ::IceInternal::Handle< ::IceDelegate::Ice::Object> __delBase;
        try
        {
#if defined(__BCPLUSPLUS__) && (__BCPLUSPLUS__ >= 0x0600) // C++Builder 2009 compiler bug
            IceUtil::DummyBCC dummy;
#endif
            __checkTwowayOnly(__RoboCompCommonHead__CommonHead__saccadic4D_name);
            __delBase = __getDelegate(false);
            ::IceDelegate::RoboCompCommonHead::CommonHead* __del = dynamic_cast< ::IceDelegate::RoboCompCommonHead::CommonHead*>(__delBase.get());
            __del->saccadic4D(leftPan, rightPan, tilt, neck, __ctx);
            return;
        }
        catch(const ::IceInternal::LocalExceptionWrapper& __ex)
        {
            __handleExceptionWrapper(__delBase, __ex, 0);
        }
        catch(const ::Ice::LocalException& __ex)
        {
            __handleException(__delBase, __ex, 0, __cnt);
        }
    }
}

void
IceProxy::RoboCompCommonHead::CommonHead::setNMotorsPosition(const ::RoboCompJointMotor::MotorGoalPositionList& listGoals, const ::Ice::Context* __ctx)
{
    int __cnt = 0;
    while(true)
    {
        ::IceInternal::Handle< ::IceDelegate::Ice::Object> __delBase;
        try
        {
#if defined(__BCPLUSPLUS__) && (__BCPLUSPLUS__ >= 0x0600) // C++Builder 2009 compiler bug
            IceUtil::DummyBCC dummy;
#endif
            __checkTwowayOnly(__RoboCompCommonHead__CommonHead__setNMotorsPosition_name);
            __delBase = __getDelegate(false);
            ::IceDelegate::RoboCompCommonHead::CommonHead* __del = dynamic_cast< ::IceDelegate::RoboCompCommonHead::CommonHead*>(__delBase.get());
            __del->setNMotorsPosition(listGoals, __ctx);
            return;
        }
        catch(const ::IceInternal::LocalExceptionWrapper& __ex)
        {
            __handleExceptionWrapper(__delBase, __ex, 0);
        }
        catch(const ::Ice::LocalException& __ex)
        {
            __handleException(__delBase, __ex, 0, __cnt);
        }
    }
}

::RoboCompCommonHead::THeadParams
IceProxy::RoboCompCommonHead::CommonHead::getHeadParams(const ::Ice::Context* __ctx)
{
    int __cnt = 0;
    while(true)
    {
        ::IceInternal::Handle< ::IceDelegate::Ice::Object> __delBase;
        try
        {
#if defined(__BCPLUSPLUS__) && (__BCPLUSPLUS__ >= 0x0600) // C++Builder 2009 compiler bug
            IceUtil::DummyBCC dummy;
#endif
            __checkTwowayOnly(__RoboCompCommonHead__CommonHead__getHeadParams_name);
            __delBase = __getDelegate(false);
            ::IceDelegate::RoboCompCommonHead::CommonHead* __del = dynamic_cast< ::IceDelegate::RoboCompCommonHead::CommonHead*>(__delBase.get());
            return __del->getHeadParams(__ctx);
        }
        catch(const ::IceInternal::LocalExceptionWrapper& __ex)
        {
            __handleExceptionWrapper(__delBase, __ex, 0);
        }
        catch(const ::Ice::LocalException& __ex)
        {
            __handleException(__delBase, __ex, 0, __cnt);
        }
    }
}

void
IceProxy::RoboCompCommonHead::CommonHead::getHeadState(::RoboCompCommonHead::THeadState& hState, const ::Ice::Context* __ctx)
{
    int __cnt = 0;
    while(true)
    {
        ::IceInternal::Handle< ::IceDelegate::Ice::Object> __delBase;
        try
        {
#if defined(__BCPLUSPLUS__) && (__BCPLUSPLUS__ >= 0x0600) // C++Builder 2009 compiler bug
            IceUtil::DummyBCC dummy;
#endif
            __checkTwowayOnly(__RoboCompCommonHead__CommonHead__getHeadState_name);
            __delBase = __getDelegate(false);
            ::IceDelegate::RoboCompCommonHead::CommonHead* __del = dynamic_cast< ::IceDelegate::RoboCompCommonHead::CommonHead*>(__delBase.get());
            __del->getHeadState(hState, __ctx);
            return;
        }
        catch(const ::IceInternal::LocalExceptionWrapper& __ex)
        {
            __handleExceptionWrapper(__delBase, __ex, 0);
        }
        catch(const ::Ice::LocalException& __ex)
        {
            __handleException(__delBase, __ex, 0, __cnt);
        }
    }
}

bool
IceProxy::RoboCompCommonHead::CommonHead::isMovingHead(const ::Ice::Context* __ctx)
{
    int __cnt = 0;
    while(true)
    {
        ::IceInternal::Handle< ::IceDelegate::Ice::Object> __delBase;
        try
        {
#if defined(__BCPLUSPLUS__) && (__BCPLUSPLUS__ >= 0x0600) // C++Builder 2009 compiler bug
            IceUtil::DummyBCC dummy;
#endif
            __checkTwowayOnly(__RoboCompCommonHead__CommonHead__isMovingHead_name);
            __delBase = __getDelegate(false);
            ::IceDelegate::RoboCompCommonHead::CommonHead* __del = dynamic_cast< ::IceDelegate::RoboCompCommonHead::CommonHead*>(__delBase.get());
            return __del->isMovingHead(__ctx);
        }
        catch(const ::IceInternal::LocalExceptionWrapper& __ex)
        {
            __handleExceptionWrapper(__delBase, __ex, 0);
        }
        catch(const ::Ice::LocalException& __ex)
        {
            __handleException(__delBase, __ex, 0, __cnt);
        }
    }
}

const ::std::string&
IceProxy::RoboCompCommonHead::CommonHead::ice_staticId()
{
    return ::RoboCompCommonHead::CommonHead::ice_staticId();
}

::IceInternal::Handle< ::IceDelegateM::Ice::Object>
IceProxy::RoboCompCommonHead::CommonHead::__createDelegateM()
{
    return ::IceInternal::Handle< ::IceDelegateM::Ice::Object>(new ::IceDelegateM::RoboCompCommonHead::CommonHead);
}

::IceInternal::Handle< ::IceDelegateD::Ice::Object>
IceProxy::RoboCompCommonHead::CommonHead::__createDelegateD()
{
    return ::IceInternal::Handle< ::IceDelegateD::Ice::Object>(new ::IceDelegateD::RoboCompCommonHead::CommonHead);
}

::IceProxy::Ice::Object*
IceProxy::RoboCompCommonHead::CommonHead::__newInstance() const
{
    return new CommonHead;
}

void
IceDelegateM::RoboCompCommonHead::CommonHead::resetHead(const ::Ice::Context* __context)
{
    ::IceInternal::Outgoing __og(__handler.get(), __RoboCompCommonHead__CommonHead__resetHead_name, ::Ice::Normal, __context);
    bool __ok = __og.invoke();
    if(!__og.is()->b.empty())
    {
        try
        {
            if(!__ok)
            {
                try
                {
                    __og.throwUserException();
                }
                catch(const ::Ice::UserException& __ex)
                {
                    ::Ice::UnknownUserException __uue(__FILE__, __LINE__, __ex.ice_name());
                    throw __uue;
                }
            }
            __og.is()->skipEmptyEncaps();
        }
        catch(const ::Ice::LocalException& __ex)
        {
            throw ::IceInternal::LocalExceptionWrapper(__ex, false);
        }
    }
}

void
IceDelegateM::RoboCompCommonHead::CommonHead::stopHead(const ::Ice::Context* __context)
{
    ::IceInternal::Outgoing __og(__handler.get(), __RoboCompCommonHead__CommonHead__stopHead_name, ::Ice::Normal, __context);
    bool __ok = __og.invoke();
    if(!__og.is()->b.empty())
    {
        try
        {
            if(!__ok)
            {
                try
                {
                    __og.throwUserException();
                }
                catch(const ::Ice::UserException& __ex)
                {
                    ::Ice::UnknownUserException __uue(__FILE__, __LINE__, __ex.ice_name());
                    throw __uue;
                }
            }
            __og.is()->skipEmptyEncaps();
        }
        catch(const ::Ice::LocalException& __ex)
        {
            throw ::IceInternal::LocalExceptionWrapper(__ex, false);
        }
    }
}

void
IceDelegateM::RoboCompCommonHead::CommonHead::setPanLeft(::Ice::Float pan, const ::Ice::Context* __context)
{
    ::IceInternal::Outgoing __og(__handler.get(), __RoboCompCommonHead__CommonHead__setPanLeft_name, ::Ice::Normal, __context);
    try
    {
        ::IceInternal::BasicStream* __os = __og.os();
        __os->write(pan);
    }
    catch(const ::Ice::LocalException& __ex)
    {
        __og.abort(__ex);
    }
    bool __ok = __og.invoke();
    try
    {
        if(!__ok)
        {
            try
            {
                __og.throwUserException();
            }
            catch(const ::RoboCompJointMotor::OutOfRangeException&)
            {
                throw;
            }
            catch(const ::Ice::UserException& __ex)
            {
                ::Ice::UnknownUserException __uue(__FILE__, __LINE__, __ex.ice_name());
                throw __uue;
            }
        }
        __og.is()->skipEmptyEncaps();
    }
    catch(const ::Ice::LocalException& __ex)
    {
        throw ::IceInternal::LocalExceptionWrapper(__ex, false);
    }
}

void
IceDelegateM::RoboCompCommonHead::CommonHead::setPanRight(::Ice::Float pan, const ::Ice::Context* __context)
{
    ::IceInternal::Outgoing __og(__handler.get(), __RoboCompCommonHead__CommonHead__setPanRight_name, ::Ice::Normal, __context);
    try
    {
        ::IceInternal::BasicStream* __os = __og.os();
        __os->write(pan);
    }
    catch(const ::Ice::LocalException& __ex)
    {
        __og.abort(__ex);
    }
    bool __ok = __og.invoke();
    try
    {
        if(!__ok)
        {
            try
            {
                __og.throwUserException();
            }
            catch(const ::RoboCompJointMotor::OutOfRangeException&)
            {
                throw;
            }
            catch(const ::Ice::UserException& __ex)
            {
                ::Ice::UnknownUserException __uue(__FILE__, __LINE__, __ex.ice_name());
                throw __uue;
            }
        }
        __og.is()->skipEmptyEncaps();
    }
    catch(const ::Ice::LocalException& __ex)
    {
        throw ::IceInternal::LocalExceptionWrapper(__ex, false);
    }
}

void
IceDelegateM::RoboCompCommonHead::CommonHead::setTilt(::Ice::Float tilt, const ::Ice::Context* __context)
{
    ::IceInternal::Outgoing __og(__handler.get(), __RoboCompCommonHead__CommonHead__setTilt_name, ::Ice::Normal, __context);
    try
    {
        ::IceInternal::BasicStream* __os = __og.os();
        __os->write(tilt);
    }
    catch(const ::Ice::LocalException& __ex)
    {
        __og.abort(__ex);
    }
    bool __ok = __og.invoke();
    try
    {
        if(!__ok)
        {
            try
            {
                __og.throwUserException();
            }
            catch(const ::RoboCompJointMotor::OutOfRangeException&)
            {
                throw;
            }
            catch(const ::Ice::UserException& __ex)
            {
                ::Ice::UnknownUserException __uue(__FILE__, __LINE__, __ex.ice_name());
                throw __uue;
            }
        }
        __og.is()->skipEmptyEncaps();
    }
    catch(const ::Ice::LocalException& __ex)
    {
        throw ::IceInternal::LocalExceptionWrapper(__ex, false);
    }
}

void
IceDelegateM::RoboCompCommonHead::CommonHead::setNeck(::Ice::Float neck, const ::Ice::Context* __context)
{
    ::IceInternal::Outgoing __og(__handler.get(), __RoboCompCommonHead__CommonHead__setNeck_name, ::Ice::Normal, __context);
    try
    {
        ::IceInternal::BasicStream* __os = __og.os();
        __os->write(neck);
    }
    catch(const ::Ice::LocalException& __ex)
    {
        __og.abort(__ex);
    }
    bool __ok = __og.invoke();
    try
    {
        if(!__ok)
        {
            try
            {
                __og.throwUserException();
            }
            catch(const ::RoboCompJointMotor::OutOfRangeException&)
            {
                throw;
            }
            catch(const ::Ice::UserException& __ex)
            {
                ::Ice::UnknownUserException __uue(__FILE__, __LINE__, __ex.ice_name());
                throw __uue;
            }
        }
        __og.is()->skipEmptyEncaps();
    }
    catch(const ::Ice::LocalException& __ex)
    {
        throw ::IceInternal::LocalExceptionWrapper(__ex, false);
    }
}

void
IceDelegateM::RoboCompCommonHead::CommonHead::saccadic2DLeft(::Ice::Float leftPan, ::Ice::Float tilt, const ::Ice::Context* __context)
{
    ::IceInternal::Outgoing __og(__handler.get(), __RoboCompCommonHead__CommonHead__saccadic2DLeft_name, ::Ice::Normal, __context);
    try
    {
        ::IceInternal::BasicStream* __os = __og.os();
        __os->write(leftPan);
        __os->write(tilt);
    }
    catch(const ::Ice::LocalException& __ex)
    {
        __og.abort(__ex);
    }
    bool __ok = __og.invoke();
    try
    {
        if(!__ok)
        {
            try
            {
                __og.throwUserException();
            }
            catch(const ::RoboCompJointMotor::OutOfRangeException&)
            {
                throw;
            }
            catch(const ::Ice::UserException& __ex)
            {
                ::Ice::UnknownUserException __uue(__FILE__, __LINE__, __ex.ice_name());
                throw __uue;
            }
        }
        __og.is()->skipEmptyEncaps();
    }
    catch(const ::Ice::LocalException& __ex)
    {
        throw ::IceInternal::LocalExceptionWrapper(__ex, false);
    }
}

void
IceDelegateM::RoboCompCommonHead::CommonHead::saccadic2DRight(::Ice::Float rightPan, ::Ice::Float tilt, const ::Ice::Context* __context)
{
    ::IceInternal::Outgoing __og(__handler.get(), __RoboCompCommonHead__CommonHead__saccadic2DRight_name, ::Ice::Normal, __context);
    try
    {
        ::IceInternal::BasicStream* __os = __og.os();
        __os->write(rightPan);
        __os->write(tilt);
    }
    catch(const ::Ice::LocalException& __ex)
    {
        __og.abort(__ex);
    }
    bool __ok = __og.invoke();
    try
    {
        if(!__ok)
        {
            try
            {
                __og.throwUserException();
            }
            catch(const ::RoboCompJointMotor::OutOfRangeException&)
            {
                throw;
            }
            catch(const ::Ice::UserException& __ex)
            {
                ::Ice::UnknownUserException __uue(__FILE__, __LINE__, __ex.ice_name());
                throw __uue;
            }
        }
        __og.is()->skipEmptyEncaps();
    }
    catch(const ::Ice::LocalException& __ex)
    {
        throw ::IceInternal::LocalExceptionWrapper(__ex, false);
    }
}

void
IceDelegateM::RoboCompCommonHead::CommonHead::saccadic3D(::Ice::Float leftPan, ::Ice::Float rightPan, ::Ice::Float tilt, const ::Ice::Context* __context)
{
    ::IceInternal::Outgoing __og(__handler.get(), __RoboCompCommonHead__CommonHead__saccadic3D_name, ::Ice::Normal, __context);
    try
    {
        ::IceInternal::BasicStream* __os = __og.os();
        __os->write(leftPan);
        __os->write(rightPan);
        __os->write(tilt);
    }
    catch(const ::Ice::LocalException& __ex)
    {
        __og.abort(__ex);
    }
    bool __ok = __og.invoke();
    try
    {
        if(!__ok)
        {
            try
            {
                __og.throwUserException();
            }
            catch(const ::RoboCompJointMotor::OutOfRangeException&)
            {
                throw;
            }
            catch(const ::Ice::UserException& __ex)
            {
                ::Ice::UnknownUserException __uue(__FILE__, __LINE__, __ex.ice_name());
                throw __uue;
            }
        }
        __og.is()->skipEmptyEncaps();
    }
    catch(const ::Ice::LocalException& __ex)
    {
        throw ::IceInternal::LocalExceptionWrapper(__ex, false);
    }
}

void
IceDelegateM::RoboCompCommonHead::CommonHead::saccadic4D(::Ice::Float leftPan, ::Ice::Float rightPan, ::Ice::Float tilt, ::Ice::Float neck, const ::Ice::Context* __context)
{
    ::IceInternal::Outgoing __og(__handler.get(), __RoboCompCommonHead__CommonHead__saccadic4D_name, ::Ice::Normal, __context);
    try
    {
        ::IceInternal::BasicStream* __os = __og.os();
        __os->write(leftPan);
        __os->write(rightPan);
        __os->write(tilt);
        __os->write(neck);
    }
    catch(const ::Ice::LocalException& __ex)
    {
        __og.abort(__ex);
    }
    bool __ok = __og.invoke();
    try
    {
        if(!__ok)
        {
            try
            {
                __og.throwUserException();
            }
            catch(const ::RoboCompJointMotor::OutOfRangeException&)
            {
                throw;
            }
            catch(const ::Ice::UserException& __ex)
            {
                ::Ice::UnknownUserException __uue(__FILE__, __LINE__, __ex.ice_name());
                throw __uue;
            }
        }
        __og.is()->skipEmptyEncaps();
    }
    catch(const ::Ice::LocalException& __ex)
    {
        throw ::IceInternal::LocalExceptionWrapper(__ex, false);
    }
}

void
IceDelegateM::RoboCompCommonHead::CommonHead::setNMotorsPosition(const ::RoboCompJointMotor::MotorGoalPositionList& listGoals, const ::Ice::Context* __context)
{
    ::IceInternal::Outgoing __og(__handler.get(), __RoboCompCommonHead__CommonHead__setNMotorsPosition_name, ::Ice::Normal, __context);
    try
    {
        ::IceInternal::BasicStream* __os = __og.os();
        if(listGoals.size() == 0)
        {
            __os->writeSize(0);
        }
        else
        {
            ::RoboCompJointMotor::__writeMotorGoalPositionList(__os, &listGoals[0], &listGoals[0] + listGoals.size());
        }
    }
    catch(const ::Ice::LocalException& __ex)
    {
        __og.abort(__ex);
    }
    bool __ok = __og.invoke();
    try
    {
        if(!__ok)
        {
            try
            {
                __og.throwUserException();
            }
            catch(const ::RoboCompJointMotor::OutOfRangeException&)
            {
                throw;
            }
            catch(const ::Ice::UserException& __ex)
            {
                ::Ice::UnknownUserException __uue(__FILE__, __LINE__, __ex.ice_name());
                throw __uue;
            }
        }
        __og.is()->skipEmptyEncaps();
    }
    catch(const ::Ice::LocalException& __ex)
    {
        throw ::IceInternal::LocalExceptionWrapper(__ex, false);
    }
}

::RoboCompCommonHead::THeadParams
IceDelegateM::RoboCompCommonHead::CommonHead::getHeadParams(const ::Ice::Context* __context)
{
    ::IceInternal::Outgoing __og(__handler.get(), __RoboCompCommonHead__CommonHead__getHeadParams_name, ::Ice::Normal, __context);
    bool __ok = __og.invoke();
    ::RoboCompCommonHead::THeadParams __ret;
    try
    {
        if(!__ok)
        {
            try
            {
                __og.throwUserException();
            }
            catch(const ::Ice::UserException& __ex)
            {
                ::Ice::UnknownUserException __uue(__FILE__, __LINE__, __ex.ice_name());
                throw __uue;
            }
        }
        ::IceInternal::BasicStream* __is = __og.is();
        __is->startReadEncaps();
        __ret.__read(__is);
        __is->endReadEncaps();
        return __ret;
    }
    catch(const ::Ice::LocalException& __ex)
    {
        throw ::IceInternal::LocalExceptionWrapper(__ex, false);
    }
}

void
IceDelegateM::RoboCompCommonHead::CommonHead::getHeadState(::RoboCompCommonHead::THeadState& hState, const ::Ice::Context* __context)
{
    ::IceInternal::Outgoing __og(__handler.get(), __RoboCompCommonHead__CommonHead__getHeadState_name, ::Ice::Normal, __context);
    bool __ok = __og.invoke();
    try
    {
        if(!__ok)
        {
            try
            {
                __og.throwUserException();
            }
            catch(const ::Ice::UserException& __ex)
            {
                ::Ice::UnknownUserException __uue(__FILE__, __LINE__, __ex.ice_name());
                throw __uue;
            }
        }
        ::IceInternal::BasicStream* __is = __og.is();
        __is->startReadEncaps();
        hState.__read(__is);
        __is->endReadEncaps();
    }
    catch(const ::Ice::LocalException& __ex)
    {
        throw ::IceInternal::LocalExceptionWrapper(__ex, false);
    }
}

bool
IceDelegateM::RoboCompCommonHead::CommonHead::isMovingHead(const ::Ice::Context* __context)
{
    ::IceInternal::Outgoing __og(__handler.get(), __RoboCompCommonHead__CommonHead__isMovingHead_name, ::Ice::Normal, __context);
    bool __ok = __og.invoke();
    bool __ret;
    try
    {
        if(!__ok)
        {
            try
            {
                __og.throwUserException();
            }
            catch(const ::Ice::UserException& __ex)
            {
                ::Ice::UnknownUserException __uue(__FILE__, __LINE__, __ex.ice_name());
                throw __uue;
            }
        }
        ::IceInternal::BasicStream* __is = __og.is();
        __is->startReadEncaps();
        __is->read(__ret);
        __is->endReadEncaps();
        return __ret;
    }
    catch(const ::Ice::LocalException& __ex)
    {
        throw ::IceInternal::LocalExceptionWrapper(__ex, false);
    }
}

void
IceDelegateD::RoboCompCommonHead::CommonHead::resetHead(const ::Ice::Context* __context)
{
    class _DirectI : public ::IceInternal::Direct
    {
    public:

        _DirectI(const ::Ice::Current& __current) : 
            ::IceInternal::Direct(__current)
        {
        }
        
        virtual ::Ice::DispatchStatus
        run(::Ice::Object* object)
        {
            ::RoboCompCommonHead::CommonHead* servant = dynamic_cast< ::RoboCompCommonHead::CommonHead*>(object);
            if(!servant)
            {
                throw ::Ice::OperationNotExistException(__FILE__, __LINE__, _current.id, _current.facet, _current.operation);
            }
            servant->resetHead(_current);
            return ::Ice::DispatchOK;
        }
        
    private:
        
    };
    
    ::Ice::Current __current;
    __initCurrent(__current, __RoboCompCommonHead__CommonHead__resetHead_name, ::Ice::Normal, __context);
    try
    {
        _DirectI __direct(__current);
        try
        {
            __direct.servant()->__collocDispatch(__direct);
        }
        catch(...)
        {
            __direct.destroy();
            throw;
        }
        __direct.destroy();
    }
    catch(const ::Ice::SystemException&)
    {
        throw;
    }
    catch(const ::IceInternal::LocalExceptionWrapper&)
    {
        throw;
    }
    catch(const ::std::exception& __ex)
    {
        ::IceInternal::LocalExceptionWrapper::throwWrapper(__ex);
    }
    catch(...)
    {
        throw ::IceInternal::LocalExceptionWrapper(::Ice::UnknownException(__FILE__, __LINE__, "unknown c++ exception"), false);
    }
}

void
IceDelegateD::RoboCompCommonHead::CommonHead::stopHead(const ::Ice::Context* __context)
{
    class _DirectI : public ::IceInternal::Direct
    {
    public:

        _DirectI(const ::Ice::Current& __current) : 
            ::IceInternal::Direct(__current)
        {
        }
        
        virtual ::Ice::DispatchStatus
        run(::Ice::Object* object)
        {
            ::RoboCompCommonHead::CommonHead* servant = dynamic_cast< ::RoboCompCommonHead::CommonHead*>(object);
            if(!servant)
            {
                throw ::Ice::OperationNotExistException(__FILE__, __LINE__, _current.id, _current.facet, _current.operation);
            }
            servant->stopHead(_current);
            return ::Ice::DispatchOK;
        }
        
    private:
        
    };
    
    ::Ice::Current __current;
    __initCurrent(__current, __RoboCompCommonHead__CommonHead__stopHead_name, ::Ice::Normal, __context);
    try
    {
        _DirectI __direct(__current);
        try
        {
            __direct.servant()->__collocDispatch(__direct);
        }
        catch(...)
        {
            __direct.destroy();
            throw;
        }
        __direct.destroy();
    }
    catch(const ::Ice::SystemException&)
    {
        throw;
    }
    catch(const ::IceInternal::LocalExceptionWrapper&)
    {
        throw;
    }
    catch(const ::std::exception& __ex)
    {
        ::IceInternal::LocalExceptionWrapper::throwWrapper(__ex);
    }
    catch(...)
    {
        throw ::IceInternal::LocalExceptionWrapper(::Ice::UnknownException(__FILE__, __LINE__, "unknown c++ exception"), false);
    }
}

void
IceDelegateD::RoboCompCommonHead::CommonHead::setPanLeft(::Ice::Float pan, const ::Ice::Context* __context)
{
    class _DirectI : public ::IceInternal::Direct
    {
    public:

        _DirectI(::Ice::Float pan, const ::Ice::Current& __current) : 
            ::IceInternal::Direct(__current),
            _m_pan(pan)
        {
        }
        
        virtual ::Ice::DispatchStatus
        run(::Ice::Object* object)
        {
            ::RoboCompCommonHead::CommonHead* servant = dynamic_cast< ::RoboCompCommonHead::CommonHead*>(object);
            if(!servant)
            {
                throw ::Ice::OperationNotExistException(__FILE__, __LINE__, _current.id, _current.facet, _current.operation);
            }
            try
            {
                servant->setPanLeft(_m_pan, _current);
                return ::Ice::DispatchOK;
            }
            catch(const ::Ice::UserException& __ex)
            {
                setUserException(__ex);
                return ::Ice::DispatchUserException;
            }
        }
        
    private:
        
        ::Ice::Float _m_pan;
    };
    
    ::Ice::Current __current;
    __initCurrent(__current, __RoboCompCommonHead__CommonHead__setPanLeft_name, ::Ice::Normal, __context);
    try
    {
        _DirectI __direct(pan, __current);
        try
        {
            __direct.servant()->__collocDispatch(__direct);
        }
        catch(...)
        {
            __direct.destroy();
            throw;
        }
        __direct.destroy();
    }
    catch(const ::RoboCompJointMotor::OutOfRangeException&)
    {
        throw;
    }
    catch(const ::Ice::SystemException&)
    {
        throw;
    }
    catch(const ::IceInternal::LocalExceptionWrapper&)
    {
        throw;
    }
    catch(const ::std::exception& __ex)
    {
        ::IceInternal::LocalExceptionWrapper::throwWrapper(__ex);
    }
    catch(...)
    {
        throw ::IceInternal::LocalExceptionWrapper(::Ice::UnknownException(__FILE__, __LINE__, "unknown c++ exception"), false);
    }
}

void
IceDelegateD::RoboCompCommonHead::CommonHead::setPanRight(::Ice::Float pan, const ::Ice::Context* __context)
{
    class _DirectI : public ::IceInternal::Direct
    {
    public:

        _DirectI(::Ice::Float pan, const ::Ice::Current& __current) : 
            ::IceInternal::Direct(__current),
            _m_pan(pan)
        {
        }
        
        virtual ::Ice::DispatchStatus
        run(::Ice::Object* object)
        {
            ::RoboCompCommonHead::CommonHead* servant = dynamic_cast< ::RoboCompCommonHead::CommonHead*>(object);
            if(!servant)
            {
                throw ::Ice::OperationNotExistException(__FILE__, __LINE__, _current.id, _current.facet, _current.operation);
            }
            try
            {
                servant->setPanRight(_m_pan, _current);
                return ::Ice::DispatchOK;
            }
            catch(const ::Ice::UserException& __ex)
            {
                setUserException(__ex);
                return ::Ice::DispatchUserException;
            }
        }
        
    private:
        
        ::Ice::Float _m_pan;
    };
    
    ::Ice::Current __current;
    __initCurrent(__current, __RoboCompCommonHead__CommonHead__setPanRight_name, ::Ice::Normal, __context);
    try
    {
        _DirectI __direct(pan, __current);
        try
        {
            __direct.servant()->__collocDispatch(__direct);
        }
        catch(...)
        {
            __direct.destroy();
            throw;
        }
        __direct.destroy();
    }
    catch(const ::RoboCompJointMotor::OutOfRangeException&)
    {
        throw;
    }
    catch(const ::Ice::SystemException&)
    {
        throw;
    }
    catch(const ::IceInternal::LocalExceptionWrapper&)
    {
        throw;
    }
    catch(const ::std::exception& __ex)
    {
        ::IceInternal::LocalExceptionWrapper::throwWrapper(__ex);
    }
    catch(...)
    {
        throw ::IceInternal::LocalExceptionWrapper(::Ice::UnknownException(__FILE__, __LINE__, "unknown c++ exception"), false);
    }
}

void
IceDelegateD::RoboCompCommonHead::CommonHead::setTilt(::Ice::Float tilt, const ::Ice::Context* __context)
{
    class _DirectI : public ::IceInternal::Direct
    {
    public:

        _DirectI(::Ice::Float tilt, const ::Ice::Current& __current) : 
            ::IceInternal::Direct(__current),
            _m_tilt(tilt)
        {
        }
        
        virtual ::Ice::DispatchStatus
        run(::Ice::Object* object)
        {
            ::RoboCompCommonHead::CommonHead* servant = dynamic_cast< ::RoboCompCommonHead::CommonHead*>(object);
            if(!servant)
            {
                throw ::Ice::OperationNotExistException(__FILE__, __LINE__, _current.id, _current.facet, _current.operation);
            }
            try
            {
                servant->setTilt(_m_tilt, _current);
                return ::Ice::DispatchOK;
            }
            catch(const ::Ice::UserException& __ex)
            {
                setUserException(__ex);
                return ::Ice::DispatchUserException;
            }
        }
        
    private:
        
        ::Ice::Float _m_tilt;
    };
    
    ::Ice::Current __current;
    __initCurrent(__current, __RoboCompCommonHead__CommonHead__setTilt_name, ::Ice::Normal, __context);
    try
    {
        _DirectI __direct(tilt, __current);
        try
        {
            __direct.servant()->__collocDispatch(__direct);
        }
        catch(...)
        {
            __direct.destroy();
            throw;
        }
        __direct.destroy();
    }
    catch(const ::RoboCompJointMotor::OutOfRangeException&)
    {
        throw;
    }
    catch(const ::Ice::SystemException&)
    {
        throw;
    }
    catch(const ::IceInternal::LocalExceptionWrapper&)
    {
        throw;
    }
    catch(const ::std::exception& __ex)
    {
        ::IceInternal::LocalExceptionWrapper::throwWrapper(__ex);
    }
    catch(...)
    {
        throw ::IceInternal::LocalExceptionWrapper(::Ice::UnknownException(__FILE__, __LINE__, "unknown c++ exception"), false);
    }
}

void
IceDelegateD::RoboCompCommonHead::CommonHead::setNeck(::Ice::Float neck, const ::Ice::Context* __context)
{
    class _DirectI : public ::IceInternal::Direct
    {
    public:

        _DirectI(::Ice::Float neck, const ::Ice::Current& __current) : 
            ::IceInternal::Direct(__current),
            _m_neck(neck)
        {
        }
        
        virtual ::Ice::DispatchStatus
        run(::Ice::Object* object)
        {
            ::RoboCompCommonHead::CommonHead* servant = dynamic_cast< ::RoboCompCommonHead::CommonHead*>(object);
            if(!servant)
            {
                throw ::Ice::OperationNotExistException(__FILE__, __LINE__, _current.id, _current.facet, _current.operation);
            }
            try
            {
                servant->setNeck(_m_neck, _current);
                return ::Ice::DispatchOK;
            }
            catch(const ::Ice::UserException& __ex)
            {
                setUserException(__ex);
                return ::Ice::DispatchUserException;
            }
        }
        
    private:
        
        ::Ice::Float _m_neck;
    };
    
    ::Ice::Current __current;
    __initCurrent(__current, __RoboCompCommonHead__CommonHead__setNeck_name, ::Ice::Normal, __context);
    try
    {
        _DirectI __direct(neck, __current);
        try
        {
            __direct.servant()->__collocDispatch(__direct);
        }
        catch(...)
        {
            __direct.destroy();
            throw;
        }
        __direct.destroy();
    }
    catch(const ::RoboCompJointMotor::OutOfRangeException&)
    {
        throw;
    }
    catch(const ::Ice::SystemException&)
    {
        throw;
    }
    catch(const ::IceInternal::LocalExceptionWrapper&)
    {
        throw;
    }
    catch(const ::std::exception& __ex)
    {
        ::IceInternal::LocalExceptionWrapper::throwWrapper(__ex);
    }
    catch(...)
    {
        throw ::IceInternal::LocalExceptionWrapper(::Ice::UnknownException(__FILE__, __LINE__, "unknown c++ exception"), false);
    }
}

void
IceDelegateD::RoboCompCommonHead::CommonHead::saccadic2DLeft(::Ice::Float leftPan, ::Ice::Float tilt, const ::Ice::Context* __context)
{
    class _DirectI : public ::IceInternal::Direct
    {
    public:

        _DirectI(::Ice::Float leftPan, ::Ice::Float tilt, const ::Ice::Current& __current) : 
            ::IceInternal::Direct(__current),
            _m_leftPan(leftPan),
            _m_tilt(tilt)
        {
        }
        
        virtual ::Ice::DispatchStatus
        run(::Ice::Object* object)
        {
            ::RoboCompCommonHead::CommonHead* servant = dynamic_cast< ::RoboCompCommonHead::CommonHead*>(object);
            if(!servant)
            {
                throw ::Ice::OperationNotExistException(__FILE__, __LINE__, _current.id, _current.facet, _current.operation);
            }
            try
            {
                servant->saccadic2DLeft(_m_leftPan, _m_tilt, _current);
                return ::Ice::DispatchOK;
            }
            catch(const ::Ice::UserException& __ex)
            {
                setUserException(__ex);
                return ::Ice::DispatchUserException;
            }
        }
        
    private:
        
        ::Ice::Float _m_leftPan;
        ::Ice::Float _m_tilt;
    };
    
    ::Ice::Current __current;
    __initCurrent(__current, __RoboCompCommonHead__CommonHead__saccadic2DLeft_name, ::Ice::Normal, __context);
    try
    {
        _DirectI __direct(leftPan, tilt, __current);
        try
        {
            __direct.servant()->__collocDispatch(__direct);
        }
        catch(...)
        {
            __direct.destroy();
            throw;
        }
        __direct.destroy();
    }
    catch(const ::RoboCompJointMotor::OutOfRangeException&)
    {
        throw;
    }
    catch(const ::Ice::SystemException&)
    {
        throw;
    }
    catch(const ::IceInternal::LocalExceptionWrapper&)
    {
        throw;
    }
    catch(const ::std::exception& __ex)
    {
        ::IceInternal::LocalExceptionWrapper::throwWrapper(__ex);
    }
    catch(...)
    {
        throw ::IceInternal::LocalExceptionWrapper(::Ice::UnknownException(__FILE__, __LINE__, "unknown c++ exception"), false);
    }
}

void
IceDelegateD::RoboCompCommonHead::CommonHead::saccadic2DRight(::Ice::Float rightPan, ::Ice::Float tilt, const ::Ice::Context* __context)
{
    class _DirectI : public ::IceInternal::Direct
    {
    public:

        _DirectI(::Ice::Float rightPan, ::Ice::Float tilt, const ::Ice::Current& __current) : 
            ::IceInternal::Direct(__current),
            _m_rightPan(rightPan),
            _m_tilt(tilt)
        {
        }
        
        virtual ::Ice::DispatchStatus
        run(::Ice::Object* object)
        {
            ::RoboCompCommonHead::CommonHead* servant = dynamic_cast< ::RoboCompCommonHead::CommonHead*>(object);
            if(!servant)
            {
                throw ::Ice::OperationNotExistException(__FILE__, __LINE__, _current.id, _current.facet, _current.operation);
            }
            try
            {
                servant->saccadic2DRight(_m_rightPan, _m_tilt, _current);
                return ::Ice::DispatchOK;
            }
            catch(const ::Ice::UserException& __ex)
            {
                setUserException(__ex);
                return ::Ice::DispatchUserException;
            }
        }
        
    private:
        
        ::Ice::Float _m_rightPan;
        ::Ice::Float _m_tilt;
    };
    
    ::Ice::Current __current;
    __initCurrent(__current, __RoboCompCommonHead__CommonHead__saccadic2DRight_name, ::Ice::Normal, __context);
    try
    {
        _DirectI __direct(rightPan, tilt, __current);
        try
        {
            __direct.servant()->__collocDispatch(__direct);
        }
        catch(...)
        {
            __direct.destroy();
            throw;
        }
        __direct.destroy();
    }
    catch(const ::RoboCompJointMotor::OutOfRangeException&)
    {
        throw;
    }
    catch(const ::Ice::SystemException&)
    {
        throw;
    }
    catch(const ::IceInternal::LocalExceptionWrapper&)
    {
        throw;
    }
    catch(const ::std::exception& __ex)
    {
        ::IceInternal::LocalExceptionWrapper::throwWrapper(__ex);
    }
    catch(...)
    {
        throw ::IceInternal::LocalExceptionWrapper(::Ice::UnknownException(__FILE__, __LINE__, "unknown c++ exception"), false);
    }
}

void
IceDelegateD::RoboCompCommonHead::CommonHead::saccadic3D(::Ice::Float leftPan, ::Ice::Float rightPan, ::Ice::Float tilt, const ::Ice::Context* __context)
{
    class _DirectI : public ::IceInternal::Direct
    {
    public:

        _DirectI(::Ice::Float leftPan, ::Ice::Float rightPan, ::Ice::Float tilt, const ::Ice::Current& __current) : 
            ::IceInternal::Direct(__current),
            _m_leftPan(leftPan),
            _m_rightPan(rightPan),
            _m_tilt(tilt)
        {
        }
        
        virtual ::Ice::DispatchStatus
        run(::Ice::Object* object)
        {
            ::RoboCompCommonHead::CommonHead* servant = dynamic_cast< ::RoboCompCommonHead::CommonHead*>(object);
            if(!servant)
            {
                throw ::Ice::OperationNotExistException(__FILE__, __LINE__, _current.id, _current.facet, _current.operation);
            }
            try
            {
                servant->saccadic3D(_m_leftPan, _m_rightPan, _m_tilt, _current);
                return ::Ice::DispatchOK;
            }
            catch(const ::Ice::UserException& __ex)
            {
                setUserException(__ex);
                return ::Ice::DispatchUserException;
            }
        }
        
    private:
        
        ::Ice::Float _m_leftPan;
        ::Ice::Float _m_rightPan;
        ::Ice::Float _m_tilt;
    };
    
    ::Ice::Current __current;
    __initCurrent(__current, __RoboCompCommonHead__CommonHead__saccadic3D_name, ::Ice::Normal, __context);
    try
    {
        _DirectI __direct(leftPan, rightPan, tilt, __current);
        try
        {
            __direct.servant()->__collocDispatch(__direct);
        }
        catch(...)
        {
            __direct.destroy();
            throw;
        }
        __direct.destroy();
    }
    catch(const ::RoboCompJointMotor::OutOfRangeException&)
    {
        throw;
    }
    catch(const ::Ice::SystemException&)
    {
        throw;
    }
    catch(const ::IceInternal::LocalExceptionWrapper&)
    {
        throw;
    }
    catch(const ::std::exception& __ex)
    {
        ::IceInternal::LocalExceptionWrapper::throwWrapper(__ex);
    }
    catch(...)
    {
        throw ::IceInternal::LocalExceptionWrapper(::Ice::UnknownException(__FILE__, __LINE__, "unknown c++ exception"), false);
    }
}

void
IceDelegateD::RoboCompCommonHead::CommonHead::saccadic4D(::Ice::Float leftPan, ::Ice::Float rightPan, ::Ice::Float tilt, ::Ice::Float neck, const ::Ice::Context* __context)
{
    class _DirectI : public ::IceInternal::Direct
    {
    public:

        _DirectI(::Ice::Float leftPan, ::Ice::Float rightPan, ::Ice::Float tilt, ::Ice::Float neck, const ::Ice::Current& __current) : 
            ::IceInternal::Direct(__current),
            _m_leftPan(leftPan),
            _m_rightPan(rightPan),
            _m_tilt(tilt),
            _m_neck(neck)
        {
        }
        
        virtual ::Ice::DispatchStatus
        run(::Ice::Object* object)
        {
            ::RoboCompCommonHead::CommonHead* servant = dynamic_cast< ::RoboCompCommonHead::CommonHead*>(object);
            if(!servant)
            {
                throw ::Ice::OperationNotExistException(__FILE__, __LINE__, _current.id, _current.facet, _current.operation);
            }
            try
            {
                servant->saccadic4D(_m_leftPan, _m_rightPan, _m_tilt, _m_neck, _current);
                return ::Ice::DispatchOK;
            }
            catch(const ::Ice::UserException& __ex)
            {
                setUserException(__ex);
                return ::Ice::DispatchUserException;
            }
        }
        
    private:
        
        ::Ice::Float _m_leftPan;
        ::Ice::Float _m_rightPan;
        ::Ice::Float _m_tilt;
        ::Ice::Float _m_neck;
    };
    
    ::Ice::Current __current;
    __initCurrent(__current, __RoboCompCommonHead__CommonHead__saccadic4D_name, ::Ice::Normal, __context);
    try
    {
        _DirectI __direct(leftPan, rightPan, tilt, neck, __current);
        try
        {
            __direct.servant()->__collocDispatch(__direct);
        }
        catch(...)
        {
            __direct.destroy();
            throw;
        }
        __direct.destroy();
    }
    catch(const ::RoboCompJointMotor::OutOfRangeException&)
    {
        throw;
    }
    catch(const ::Ice::SystemException&)
    {
        throw;
    }
    catch(const ::IceInternal::LocalExceptionWrapper&)
    {
        throw;
    }
    catch(const ::std::exception& __ex)
    {
        ::IceInternal::LocalExceptionWrapper::throwWrapper(__ex);
    }
    catch(...)
    {
        throw ::IceInternal::LocalExceptionWrapper(::Ice::UnknownException(__FILE__, __LINE__, "unknown c++ exception"), false);
    }
}

void
IceDelegateD::RoboCompCommonHead::CommonHead::setNMotorsPosition(const ::RoboCompJointMotor::MotorGoalPositionList& listGoals, const ::Ice::Context* __context)
{
    class _DirectI : public ::IceInternal::Direct
    {
    public:

        _DirectI(const ::RoboCompJointMotor::MotorGoalPositionList& listGoals, const ::Ice::Current& __current) : 
            ::IceInternal::Direct(__current),
            _m_listGoals(listGoals)
        {
        }
        
        virtual ::Ice::DispatchStatus
        run(::Ice::Object* object)
        {
            ::RoboCompCommonHead::CommonHead* servant = dynamic_cast< ::RoboCompCommonHead::CommonHead*>(object);
            if(!servant)
            {
                throw ::Ice::OperationNotExistException(__FILE__, __LINE__, _current.id, _current.facet, _current.operation);
            }
            try
            {
                servant->setNMotorsPosition(_m_listGoals, _current);
                return ::Ice::DispatchOK;
            }
            catch(const ::Ice::UserException& __ex)
            {
                setUserException(__ex);
                return ::Ice::DispatchUserException;
            }
        }
        
    private:
        
        const ::RoboCompJointMotor::MotorGoalPositionList& _m_listGoals;
    };
    
    ::Ice::Current __current;
    __initCurrent(__current, __RoboCompCommonHead__CommonHead__setNMotorsPosition_name, ::Ice::Normal, __context);
    try
    {
        _DirectI __direct(listGoals, __current);
        try
        {
            __direct.servant()->__collocDispatch(__direct);
        }
        catch(...)
        {
            __direct.destroy();
            throw;
        }
        __direct.destroy();
    }
    catch(const ::RoboCompJointMotor::OutOfRangeException&)
    {
        throw;
    }
    catch(const ::Ice::SystemException&)
    {
        throw;
    }
    catch(const ::IceInternal::LocalExceptionWrapper&)
    {
        throw;
    }
    catch(const ::std::exception& __ex)
    {
        ::IceInternal::LocalExceptionWrapper::throwWrapper(__ex);
    }
    catch(...)
    {
        throw ::IceInternal::LocalExceptionWrapper(::Ice::UnknownException(__FILE__, __LINE__, "unknown c++ exception"), false);
    }
}

::RoboCompCommonHead::THeadParams
IceDelegateD::RoboCompCommonHead::CommonHead::getHeadParams(const ::Ice::Context* __context)
{
    class _DirectI : public ::IceInternal::Direct
    {
    public:

        _DirectI(::RoboCompCommonHead::THeadParams& __result, const ::Ice::Current& __current) : 
            ::IceInternal::Direct(__current),
            _result(__result)
        {
        }
        
        virtual ::Ice::DispatchStatus
        run(::Ice::Object* object)
        {
            ::RoboCompCommonHead::CommonHead* servant = dynamic_cast< ::RoboCompCommonHead::CommonHead*>(object);
            if(!servant)
            {
                throw ::Ice::OperationNotExistException(__FILE__, __LINE__, _current.id, _current.facet, _current.operation);
            }
            _result = servant->getHeadParams(_current);
            return ::Ice::DispatchOK;
        }
        
    private:
        
        ::RoboCompCommonHead::THeadParams& _result;
    };
    
    ::Ice::Current __current;
    __initCurrent(__current, __RoboCompCommonHead__CommonHead__getHeadParams_name, ::Ice::Normal, __context);
    ::RoboCompCommonHead::THeadParams __result;
    try
    {
        _DirectI __direct(__result, __current);
        try
        {
            __direct.servant()->__collocDispatch(__direct);
        }
        catch(...)
        {
            __direct.destroy();
            throw;
        }
        __direct.destroy();
    }
    catch(const ::Ice::SystemException&)
    {
        throw;
    }
    catch(const ::IceInternal::LocalExceptionWrapper&)
    {
        throw;
    }
    catch(const ::std::exception& __ex)
    {
        ::IceInternal::LocalExceptionWrapper::throwWrapper(__ex);
    }
    catch(...)
    {
        throw ::IceInternal::LocalExceptionWrapper(::Ice::UnknownException(__FILE__, __LINE__, "unknown c++ exception"), false);
    }
    return __result;
}

void
IceDelegateD::RoboCompCommonHead::CommonHead::getHeadState(::RoboCompCommonHead::THeadState& hState, const ::Ice::Context* __context)
{
    class _DirectI : public ::IceInternal::Direct
    {
    public:

        _DirectI(::RoboCompCommonHead::THeadState& hState, const ::Ice::Current& __current) : 
            ::IceInternal::Direct(__current),
            _m_hState(hState)
        {
        }
        
        virtual ::Ice::DispatchStatus
        run(::Ice::Object* object)
        {
            ::RoboCompCommonHead::CommonHead* servant = dynamic_cast< ::RoboCompCommonHead::CommonHead*>(object);
            if(!servant)
            {
                throw ::Ice::OperationNotExistException(__FILE__, __LINE__, _current.id, _current.facet, _current.operation);
            }
            servant->getHeadState(_m_hState, _current);
            return ::Ice::DispatchOK;
        }
        
    private:
        
        ::RoboCompCommonHead::THeadState& _m_hState;
    };
    
    ::Ice::Current __current;
    __initCurrent(__current, __RoboCompCommonHead__CommonHead__getHeadState_name, ::Ice::Normal, __context);
    try
    {
        _DirectI __direct(hState, __current);
        try
        {
            __direct.servant()->__collocDispatch(__direct);
        }
        catch(...)
        {
            __direct.destroy();
            throw;
        }
        __direct.destroy();
    }
    catch(const ::Ice::SystemException&)
    {
        throw;
    }
    catch(const ::IceInternal::LocalExceptionWrapper&)
    {
        throw;
    }
    catch(const ::std::exception& __ex)
    {
        ::IceInternal::LocalExceptionWrapper::throwWrapper(__ex);
    }
    catch(...)
    {
        throw ::IceInternal::LocalExceptionWrapper(::Ice::UnknownException(__FILE__, __LINE__, "unknown c++ exception"), false);
    }
}

bool
IceDelegateD::RoboCompCommonHead::CommonHead::isMovingHead(const ::Ice::Context* __context)
{
    class _DirectI : public ::IceInternal::Direct
    {
    public:

        _DirectI(bool& __result, const ::Ice::Current& __current) : 
            ::IceInternal::Direct(__current),
            _result(__result)
        {
        }
        
        virtual ::Ice::DispatchStatus
        run(::Ice::Object* object)
        {
            ::RoboCompCommonHead::CommonHead* servant = dynamic_cast< ::RoboCompCommonHead::CommonHead*>(object);
            if(!servant)
            {
                throw ::Ice::OperationNotExistException(__FILE__, __LINE__, _current.id, _current.facet, _current.operation);
            }
            _result = servant->isMovingHead(_current);
            return ::Ice::DispatchOK;
        }
        
    private:
        
        bool& _result;
    };
    
    ::Ice::Current __current;
    __initCurrent(__current, __RoboCompCommonHead__CommonHead__isMovingHead_name, ::Ice::Normal, __context);
    bool __result;
    try
    {
        _DirectI __direct(__result, __current);
        try
        {
            __direct.servant()->__collocDispatch(__direct);
        }
        catch(...)
        {
            __direct.destroy();
            throw;
        }
        __direct.destroy();
    }
    catch(const ::Ice::SystemException&)
    {
        throw;
    }
    catch(const ::IceInternal::LocalExceptionWrapper&)
    {
        throw;
    }
    catch(const ::std::exception& __ex)
    {
        ::IceInternal::LocalExceptionWrapper::throwWrapper(__ex);
    }
    catch(...)
    {
        throw ::IceInternal::LocalExceptionWrapper(::Ice::UnknownException(__FILE__, __LINE__, "unknown c++ exception"), false);
    }
    return __result;
}

::Ice::ObjectPtr
RoboCompCommonHead::CommonHead::ice_clone() const
{
    throw ::Ice::CloneNotImplementedException(__FILE__, __LINE__);
    return 0; // to avoid a warning with some compilers
}

static const ::std::string __RoboCompCommonHead__CommonHead_ids[2] =
{
    "::Ice::Object",
    "::RoboCompCommonHead::CommonHead"
};

bool
RoboCompCommonHead::CommonHead::ice_isA(const ::std::string& _s, const ::Ice::Current&) const
{
    return ::std::binary_search(__RoboCompCommonHead__CommonHead_ids, __RoboCompCommonHead__CommonHead_ids + 2, _s);
}

::std::vector< ::std::string>
RoboCompCommonHead::CommonHead::ice_ids(const ::Ice::Current&) const
{
    return ::std::vector< ::std::string>(&__RoboCompCommonHead__CommonHead_ids[0], &__RoboCompCommonHead__CommonHead_ids[2]);
}

const ::std::string&
RoboCompCommonHead::CommonHead::ice_id(const ::Ice::Current&) const
{
    return __RoboCompCommonHead__CommonHead_ids[1];
}

const ::std::string&
RoboCompCommonHead::CommonHead::ice_staticId()
{
    return __RoboCompCommonHead__CommonHead_ids[1];
}

::Ice::DispatchStatus
RoboCompCommonHead::CommonHead::___resetHead(::IceInternal::Incoming& __inS, const ::Ice::Current& __current)
{
    __checkMode(::Ice::Normal, __current.mode);
    __inS.is()->skipEmptyEncaps();
    resetHead(__current);
    return ::Ice::DispatchOK;
}

::Ice::DispatchStatus
RoboCompCommonHead::CommonHead::___stopHead(::IceInternal::Incoming& __inS, const ::Ice::Current& __current)
{
    __checkMode(::Ice::Normal, __current.mode);
    __inS.is()->skipEmptyEncaps();
    stopHead(__current);
    return ::Ice::DispatchOK;
}

::Ice::DispatchStatus
RoboCompCommonHead::CommonHead::___setPanLeft(::IceInternal::Incoming& __inS, const ::Ice::Current& __current)
{
    __checkMode(::Ice::Normal, __current.mode);
    ::IceInternal::BasicStream* __is = __inS.is();
    __is->startReadEncaps();
    ::Ice::Float pan;
    __is->read(pan);
    __is->endReadEncaps();
    ::IceInternal::BasicStream* __os = __inS.os();
    try
    {
        setPanLeft(pan, __current);
    }
    catch(const ::RoboCompJointMotor::OutOfRangeException& __ex)
    {
        __os->write(__ex);
        return ::Ice::DispatchUserException;
    }
    return ::Ice::DispatchOK;
}

::Ice::DispatchStatus
RoboCompCommonHead::CommonHead::___setPanRight(::IceInternal::Incoming& __inS, const ::Ice::Current& __current)
{
    __checkMode(::Ice::Normal, __current.mode);
    ::IceInternal::BasicStream* __is = __inS.is();
    __is->startReadEncaps();
    ::Ice::Float pan;
    __is->read(pan);
    __is->endReadEncaps();
    ::IceInternal::BasicStream* __os = __inS.os();
    try
    {
        setPanRight(pan, __current);
    }
    catch(const ::RoboCompJointMotor::OutOfRangeException& __ex)
    {
        __os->write(__ex);
        return ::Ice::DispatchUserException;
    }
    return ::Ice::DispatchOK;
}

::Ice::DispatchStatus
RoboCompCommonHead::CommonHead::___setTilt(::IceInternal::Incoming& __inS, const ::Ice::Current& __current)
{
    __checkMode(::Ice::Normal, __current.mode);
    ::IceInternal::BasicStream* __is = __inS.is();
    __is->startReadEncaps();
    ::Ice::Float tilt;
    __is->read(tilt);
    __is->endReadEncaps();
    ::IceInternal::BasicStream* __os = __inS.os();
    try
    {
        setTilt(tilt, __current);
    }
    catch(const ::RoboCompJointMotor::OutOfRangeException& __ex)
    {
        __os->write(__ex);
        return ::Ice::DispatchUserException;
    }
    return ::Ice::DispatchOK;
}

::Ice::DispatchStatus
RoboCompCommonHead::CommonHead::___setNeck(::IceInternal::Incoming& __inS, const ::Ice::Current& __current)
{
    __checkMode(::Ice::Normal, __current.mode);
    ::IceInternal::BasicStream* __is = __inS.is();
    __is->startReadEncaps();
    ::Ice::Float neck;
    __is->read(neck);
    __is->endReadEncaps();
    ::IceInternal::BasicStream* __os = __inS.os();
    try
    {
        setNeck(neck, __current);
    }
    catch(const ::RoboCompJointMotor::OutOfRangeException& __ex)
    {
        __os->write(__ex);
        return ::Ice::DispatchUserException;
    }
    return ::Ice::DispatchOK;
}

::Ice::DispatchStatus
RoboCompCommonHead::CommonHead::___saccadic2DLeft(::IceInternal::Incoming& __inS, const ::Ice::Current& __current)
{
    __checkMode(::Ice::Normal, __current.mode);
    ::IceInternal::BasicStream* __is = __inS.is();
    __is->startReadEncaps();
    ::Ice::Float leftPan;
    ::Ice::Float tilt;
    __is->read(leftPan);
    __is->read(tilt);
    __is->endReadEncaps();
    ::IceInternal::BasicStream* __os = __inS.os();
    try
    {
        saccadic2DLeft(leftPan, tilt, __current);
    }
    catch(const ::RoboCompJointMotor::OutOfRangeException& __ex)
    {
        __os->write(__ex);
        return ::Ice::DispatchUserException;
    }
    return ::Ice::DispatchOK;
}

::Ice::DispatchStatus
RoboCompCommonHead::CommonHead::___saccadic2DRight(::IceInternal::Incoming& __inS, const ::Ice::Current& __current)
{
    __checkMode(::Ice::Normal, __current.mode);
    ::IceInternal::BasicStream* __is = __inS.is();
    __is->startReadEncaps();
    ::Ice::Float rightPan;
    ::Ice::Float tilt;
    __is->read(rightPan);
    __is->read(tilt);
    __is->endReadEncaps();
    ::IceInternal::BasicStream* __os = __inS.os();
    try
    {
        saccadic2DRight(rightPan, tilt, __current);
    }
    catch(const ::RoboCompJointMotor::OutOfRangeException& __ex)
    {
        __os->write(__ex);
        return ::Ice::DispatchUserException;
    }
    return ::Ice::DispatchOK;
}

::Ice::DispatchStatus
RoboCompCommonHead::CommonHead::___saccadic3D(::IceInternal::Incoming& __inS, const ::Ice::Current& __current)
{
    __checkMode(::Ice::Normal, __current.mode);
    ::IceInternal::BasicStream* __is = __inS.is();
    __is->startReadEncaps();
    ::Ice::Float leftPan;
    ::Ice::Float rightPan;
    ::Ice::Float tilt;
    __is->read(leftPan);
    __is->read(rightPan);
    __is->read(tilt);
    __is->endReadEncaps();
    ::IceInternal::BasicStream* __os = __inS.os();
    try
    {
        saccadic3D(leftPan, rightPan, tilt, __current);
    }
    catch(const ::RoboCompJointMotor::OutOfRangeException& __ex)
    {
        __os->write(__ex);
        return ::Ice::DispatchUserException;
    }
    return ::Ice::DispatchOK;
}

::Ice::DispatchStatus
RoboCompCommonHead::CommonHead::___saccadic4D(::IceInternal::Incoming& __inS, const ::Ice::Current& __current)
{
    __checkMode(::Ice::Normal, __current.mode);
    ::IceInternal::BasicStream* __is = __inS.is();
    __is->startReadEncaps();
    ::Ice::Float leftPan;
    ::Ice::Float rightPan;
    ::Ice::Float tilt;
    ::Ice::Float neck;
    __is->read(leftPan);
    __is->read(rightPan);
    __is->read(tilt);
    __is->read(neck);
    __is->endReadEncaps();
    ::IceInternal::BasicStream* __os = __inS.os();
    try
    {
        saccadic4D(leftPan, rightPan, tilt, neck, __current);
    }
    catch(const ::RoboCompJointMotor::OutOfRangeException& __ex)
    {
        __os->write(__ex);
        return ::Ice::DispatchUserException;
    }
    return ::Ice::DispatchOK;
}

::Ice::DispatchStatus
RoboCompCommonHead::CommonHead::___setNMotorsPosition(::IceInternal::Incoming& __inS, const ::Ice::Current& __current)
{
    __checkMode(::Ice::Normal, __current.mode);
    ::IceInternal::BasicStream* __is = __inS.is();
    __is->startReadEncaps();
    ::RoboCompJointMotor::MotorGoalPositionList listGoals;
    ::RoboCompJointMotor::__readMotorGoalPositionList(__is, listGoals);
    __is->endReadEncaps();
    ::IceInternal::BasicStream* __os = __inS.os();
    try
    {
        setNMotorsPosition(listGoals, __current);
    }
    catch(const ::RoboCompJointMotor::OutOfRangeException& __ex)
    {
        __os->write(__ex);
        return ::Ice::DispatchUserException;
    }
    return ::Ice::DispatchOK;
}

::Ice::DispatchStatus
RoboCompCommonHead::CommonHead::___getHeadParams(::IceInternal::Incoming& __inS, const ::Ice::Current& __current)
{
    __checkMode(::Ice::Normal, __current.mode);
    __inS.is()->skipEmptyEncaps();
    ::IceInternal::BasicStream* __os = __inS.os();
    ::RoboCompCommonHead::THeadParams __ret = getHeadParams(__current);
    __ret.__write(__os);
    return ::Ice::DispatchOK;
}

::Ice::DispatchStatus
RoboCompCommonHead::CommonHead::___getHeadState(::IceInternal::Incoming& __inS, const ::Ice::Current& __current)
{
    __checkMode(::Ice::Normal, __current.mode);
    __inS.is()->skipEmptyEncaps();
    ::IceInternal::BasicStream* __os = __inS.os();
    ::RoboCompCommonHead::THeadState hState;
    getHeadState(hState, __current);
    hState.__write(__os);
    return ::Ice::DispatchOK;
}

::Ice::DispatchStatus
RoboCompCommonHead::CommonHead::___isMovingHead(::IceInternal::Incoming& __inS, const ::Ice::Current& __current)
{
    __checkMode(::Ice::Normal, __current.mode);
    __inS.is()->skipEmptyEncaps();
    ::IceInternal::BasicStream* __os = __inS.os();
    bool __ret = isMovingHead(__current);
    __os->write(__ret);
    return ::Ice::DispatchOK;
}

static ::std::string __RoboCompCommonHead__CommonHead_all[] =
{
    "getHeadParams",
    "getHeadState",
    "ice_id",
    "ice_ids",
    "ice_isA",
    "ice_ping",
    "isMovingHead",
    "resetHead",
    "saccadic2DLeft",
    "saccadic2DRight",
    "saccadic3D",
    "saccadic4D",
    "setNMotorsPosition",
    "setNeck",
    "setPanLeft",
    "setPanRight",
    "setTilt",
    "stopHead"
};

::Ice::DispatchStatus
RoboCompCommonHead::CommonHead::__dispatch(::IceInternal::Incoming& in, const ::Ice::Current& current)
{
    ::std::pair< ::std::string*, ::std::string*> r = ::std::equal_range(__RoboCompCommonHead__CommonHead_all, __RoboCompCommonHead__CommonHead_all + 18, current.operation);
    if(r.first == r.second)
    {
        throw ::Ice::OperationNotExistException(__FILE__, __LINE__, current.id, current.facet, current.operation);
    }

    switch(r.first - __RoboCompCommonHead__CommonHead_all)
    {
        case 0:
        {
            return ___getHeadParams(in, current);
        }
        case 1:
        {
            return ___getHeadState(in, current);
        }
        case 2:
        {
            return ___ice_id(in, current);
        }
        case 3:
        {
            return ___ice_ids(in, current);
        }
        case 4:
        {
            return ___ice_isA(in, current);
        }
        case 5:
        {
            return ___ice_ping(in, current);
        }
        case 6:
        {
            return ___isMovingHead(in, current);
        }
        case 7:
        {
            return ___resetHead(in, current);
        }
        case 8:
        {
            return ___saccadic2DLeft(in, current);
        }
        case 9:
        {
            return ___saccadic2DRight(in, current);
        }
        case 10:
        {
            return ___saccadic3D(in, current);
        }
        case 11:
        {
            return ___saccadic4D(in, current);
        }
        case 12:
        {
            return ___setNMotorsPosition(in, current);
        }
        case 13:
        {
            return ___setNeck(in, current);
        }
        case 14:
        {
            return ___setPanLeft(in, current);
        }
        case 15:
        {
            return ___setPanRight(in, current);
        }
        case 16:
        {
            return ___setTilt(in, current);
        }
        case 17:
        {
            return ___stopHead(in, current);
        }
    }

    assert(false);
    throw ::Ice::OperationNotExistException(__FILE__, __LINE__, current.id, current.facet, current.operation);
}

void
RoboCompCommonHead::CommonHead::__write(::IceInternal::BasicStream* __os) const
{
    __os->writeTypeId(ice_staticId());
    __os->startWriteSlice();
    __os->endWriteSlice();
#if defined(_MSC_VER) && (_MSC_VER < 1300) // VC++ 6 compiler bug
    Object::__write(__os);
#else
    ::Ice::Object::__write(__os);
#endif
}

void
RoboCompCommonHead::CommonHead::__read(::IceInternal::BasicStream* __is, bool __rid)
{
    if(__rid)
    {
        ::std::string myId;
        __is->readTypeId(myId);
    }
    __is->startReadSlice();
    __is->endReadSlice();
#if defined(_MSC_VER) && (_MSC_VER < 1300) // VC++ 6 compiler bug
    Object::__read(__is, true);
#else
    ::Ice::Object::__read(__is, true);
#endif
}

void
RoboCompCommonHead::CommonHead::__write(const ::Ice::OutputStreamPtr&) const
{
    Ice::MarshalException ex(__FILE__, __LINE__);
    ex.reason = "type RoboCompCommonHead::CommonHead was not generated with stream support";
    throw ex;
}

void
RoboCompCommonHead::CommonHead::__read(const ::Ice::InputStreamPtr&, bool)
{
    Ice::MarshalException ex(__FILE__, __LINE__);
    ex.reason = "type RoboCompCommonHead::CommonHead was not generated with stream support";
    throw ex;
}

void 
RoboCompCommonHead::__patch__CommonHeadPtr(void* __addr, ::Ice::ObjectPtr& v)
{
    ::RoboCompCommonHead::CommonHeadPtr* p = static_cast< ::RoboCompCommonHead::CommonHeadPtr*>(__addr);
    assert(p);
    *p = ::RoboCompCommonHead::CommonHeadPtr::dynamicCast(v);
    if(v && !*p)
    {
        IceInternal::Ex::throwUOE(::RoboCompCommonHead::CommonHead::ice_staticId(), v->ice_id());
    }
}

bool
RoboCompCommonHead::operator==(const ::RoboCompCommonHead::CommonHead& l, const ::RoboCompCommonHead::CommonHead& r)
{
    return static_cast<const ::Ice::Object&>(l) == static_cast<const ::Ice::Object&>(r);
}

bool
RoboCompCommonHead::operator<(const ::RoboCompCommonHead::CommonHead& l, const ::RoboCompCommonHead::CommonHead& r)
{
    return static_cast<const ::Ice::Object&>(l) < static_cast<const ::Ice::Object&>(r);
}
